package design.pattern.factory.factory;

import design.pattern.factory.factory.impl.AppleIceCreamFactory;
import design.pattern.factory.factory.impl.BananaIceCreamFactory;
import design.pattern.factory.factory.impl.OrangeIceCreamFactory;

/**
 * @program: design-pattern
 * @description: 测试工厂模式
 * @author: dong.chang
 * @create: 2021-04-22 11:39
 **/
public class FactoryTest {
    public static void main(String[] args) {

        //生产苹果味冰激凌
        IceCreamFactory appleFactory = new AppleIceCreamFactory();
        IceCream appleIceCream = appleFactory.createIceCream();
        appleIceCream.taste();

        //香蕉
        IceCreamFactory  bananaFactory = new BananaIceCreamFactory();
        IceCream bananaIceCream = bananaFactory.createIceCream();
        bananaIceCream.taste();

        //橘子
        IceCreamFactory orangeFactory = new OrangeIceCreamFactory();
        IceCream orangeIceCream = orangeFactory.createIceCream();
        orangeIceCream.taste();
    }
}
